<template>
	<view class="uni-popup-share" :class="APPTheme">
		<view class="theme-bg">
			<view class="uni-share-title"><text class="uni-share-title-text">{{title}}</text></view>
			<view class="uni-share-content">
				<view class="uni-share-content-box">
					<view class="uni-share-content-item" v-for="(item,index) in bottomData" :key="index" @click.stop="select(item,index)">
						<image class="uni-share-image" :src="item.icon" mode="aspectFill"></image>
						<text class="uni-share-text">{{item.text}}</text>
					</view>
			
				</view>
			</view>
			<view class="uni-share-button-box">
				<!-- <button class="uni-share-button" @click="close" >取消</button> -->
			</view>
		</view>
		
	</view>
</template>

<script>
	import {
		mapGetters,
		mapActions
	} from 'vuex'
	export default {
		computed:{
			...mapGetters(['APPTheme', 'userInfo', 'api']),
		},
		name: 'UniPopupShare',
		props: {
			title: {
				type: String,
				default: '分享到'
			},
			filingType:{//0共享盘1私人盘2加密盘
				type: [String,Number],
				default: 0
			}
		},
		inject: ['popup'],
		data() {
			return {
				bottomData: [{
						text: '文档',
						icon: '/static/image/filemanag/doc.png',
						name: 'wd'
					},
					{
						text: '表格',
						icon: '/static/image/filemanag/xlsx.png',
						name: 'bg'
					},
					{
						text: '文件夹',
						icon: '/static/image/filemanag/wenjianja.png',
						name: 'wjj'
					},
					{
						text: '上传',
						icon: '/static/image/filemanag/shangchuan.png',
						name: 'sc'
					}
				],
			}
		},
		mounted() {
			//判断权限
			this.JudgmentAuthority()
		},
		methods: {
			//判断权限
			JudgmentAuthority(){
				//filingType==0共享盘，1私人盘，2加密盘
				if(this.filingType==2){
					this.bottomData=[{
						text: '文件夹',
						icon: '/static/image/filemanag/wenjianja.png',
						name: 'wjj'
					},
					{
						text: '上传',
						icon: '/static/image/filemanag/shangchuan.png',
						name: 'sc'
					}]
				}else{
					this.bottomData=[{
						text: '文档',
						icon: '/static/image/filemanag/doc.png',
						name: 'wd'
					},
					{
						text: '表格',
						icon: '/static/image/filemanag/xlsx.png',
						name: 'bg'
					},
					{
						text: '文件夹',
						icon: '/static/image/filemanag/wenjianja.png',
						name: 'wjj'
					},
					{
						text: '上传',
						icon: '/static/image/filemanag/shangchuan.png',
						name: 'sc'
					}
				]
				}
			},
			/**
			 * 选择内容
			 */
			select(item, index) {
				this.$emit('select', {
					item,
					index
				}, () => {
					this.popup.close()
				})
			},
			/**
			 * 关闭窗口
			 */
			close() {
				this.popup.close()
			}
		}
	}
</script>
<style lang="scss" scoped>
	.theme-bg {
		border-radius: 10px 10px 0 0;
		@include background_color("background_color2");
	}
	.uni-share-title {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		align-items: center;
		justify-content: center;
		height: 40px;
	}
	.uni-share-title-text {
		font-size: 14px;
		@include font_color("font_color1");
	}
	.uni-share-content {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		justify-content: center;
		padding-top: 10px;
	}
	
	.uni-share-content-box {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		flex-wrap: wrap;
		width: 360px;
	}
	
	.uni-share-content-item {
		width: 120px;
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: column;
		justify-content: center;
		padding: 10px 0;
		align-items: center;
	}
	
	.uni-share-content-item:active {
		background-color: #f5f5f5;
	}
	
	.uni-share-image {
		width: 30px;
		height: 30px;
	}
	
	.uni-share-text {
		margin-top: 10px;
		font-size: 14px;
		@include font_color("font_color1");
	}
	
	.uni-share-button-box {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		padding: 10px 15px;
	}
	
	.uni-share-button {
		flex: 1;
		border-radius: 50px;
		color: #666;
		font-size: 16px;
	}
	
	.uni-share-button::after {
		border-radius: 50px;
	}
</style>
